class valid_palindrome(object):
    """docstring for valid_palindrome"""
    def isPalindrome(self, s):
        lst = list(s)
        i = 0
        while(i < len(lst)):
            if lst[i].isalnum():
                if lst[i].isupper():
                    lst[i] = lst[i].lower()
                i += 1
            else:
                del lst[i]
        a = len(lst)/2
        b = -1 - a
        first_half = ''.join(lst[:a])
        second_half = ''.join(lst[:b:-1])
        return first_half == second_half

# pdb.set_trace()
ss = valid_palindrome()
print ss.isPalindrome("A man, a plan, a canal: panama")
print ss.isPalindrome("race e car")
print ss.isPalindrome("")
